{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import math\n",
    "\n",
    "# Load data\n",
    "results = np.loadtxt(\"../data/experiments/online_results.txt\") # id, time[s], octree_overlap\n",
    "                                                                                     # alignability, alignment_risk\n",
    "                                                                                     # degeneracy, ICN\n",
    "results = np.array([results]).T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "f, axarr = plt.subplots(2, sharex=True)\n",
    "shape = results.shape\n",
    "\n",
    "axarr[0].plot(results[1], results[5],'k')\n",
    "axarr[0].set_ylim([0,0.06])\n",
    "axarr[0].plot((results[1][0],results[1][shape[1]-1]), [0.05,0.05], 'r',linewidth=2.0)\n",
    "axarr[0].set_xlim((results[1][0],results[1][shape[1]-1]))\n",
    "axarr[0].set_ylabel('Degeneracy')\n",
    "axarr[1].plot(results[1], results[4],'k')\n",
    "axarr[1].plot((results[1][0],results[1][shape[1]-1]), [0.5,0.5], 'r',linewidth=2.0)\n",
    "axarr[1].set_ylim([0.495,0.505])\n",
    "axarr[1].set_ylabel('Alignment Risk')\n",
    "axarr[1].set_xlabel('Time [s]')\n",
    "\n",
    "axarr[0].axvspan(112, 120, facecolor='r', alpha=0.3)\n",
    "axarr[1].axvspan(112, 120, facecolor='g', alpha=0.3)\n",
    "\n",
    "axarr[0].axvspan(175, 183, facecolor='r', alpha=0.3)\n",
    "axarr[1].axvspan(175, 183, facecolor='g', alpha=0.3)\n",
    "\n",
    "axarr[0].axvspan(205, 213, facecolor='r', alpha=0.3)\n",
    "axarr[1].axvspan(205, 213, facecolor='g', alpha=0.3)\n",
    "\n",
    "axarr[0].axvspan(290, 335, facecolor='r', alpha=0.3)\n",
    "axarr[1].axvspan(290, 335, facecolor='g', alpha=0.3)\n",
    "\n",
    "axarr[0].axhspan(0.05, 0.06, facecolor='k', alpha=0.2)\n",
    "axarr[1].axhspan(0.495, 0.5, facecolor='k', alpha=0.2)\n",
    "\n",
    "# axarr[0].text(50, -0.008, 'A', color='black', horizontalalignment='center',\n",
    "#          fontsize=15, bbox=dict(facecolor='white', edgecolor='black', boxstyle='round'))\n",
    "axarr[0].text(115, -0.008, '1', color='black', horizontalalignment='center',\n",
    "         fontsize=15, bbox=dict(facecolor='white', edgecolor='black', pad=8))\n",
    "# axarr[0].text(150, -0.008, 'B', color='black', horizontalalignment='center',\n",
    "#          fontsize=15, bbox=dict(facecolor='white', edgecolor='black', boxstyle='round'))\n",
    "axarr[0].text(180, -0.008, '2', color='black', horizontalalignment='center',\n",
    "         fontsize=15, bbox=dict(facecolor='white', edgecolor='black', pad=8))\n",
    "axarr[0].text(210, -0.008, '3', color='black', horizontalalignment='center',\n",
    "         fontsize=15, bbox=dict(facecolor='white', edgecolor='black', pad=8))\n",
    "# axarr[0].text(240, -0.008, 'C', color='black', horizontalalignment='center',\n",
    "#          fontsize=15, bbox=dict(facecolor='white', edgecolor='black', boxstyle='round'))\n",
    "axarr[0].text(310, -0.008, '4', color='black', horizontalalignment='center',\n",
    "         fontsize=15, bbox=dict(facecolor='white', edgecolor='black', pad=8))\n",
    "# axarr[0].text(365, -0.008, 'D', color='black', horizontalalignment='center',\n",
    "#          fontsize=15, bbox=dict(facecolor='white', edgecolor='black', boxstyle='round'))\n",
    "\n",
    "# axarr[0].grid()\n",
    "# axarr[1].grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
